library(foreign)
x <- read.spss("E:\\DEMO REGRESSION DATA\\crimes_loc01.sav")
x1 <- data.frame(x)
x4 <- na.omit(x1)
plot(c(110,180),c(20,240), axes=F, type="n",
main="Crimes committed in two locations", xlab="Age", ylab="Number of Crimes committed")
axis(1, at=c(0,110,120,130,140,150,160,170,180))
axis(2, at=c(0,20,40,60,80,100,120,140,160,180,200,220))
points(x1$age0,x1$crime0,pch=0)
z <- lm(x1$crime0 ~ x1$age0)
abline(z,lty=3)
points(x1$age1,x1$crime1,pch=1)
z1 <- lm(x1$crime1 ~ x1$age1)
abline(z1,lty=1)
legend(x=155,y=220,c("Manchester","Newcastle"), pch=c(0,1),lty=c(3,1))

x4
attach(x4)
crime <- c(crime0,crime1)
crime
age <- c(age0,age1)
site <- c(rep(0,16),rep(1,16))
anova(lm(crime~site+age),lm(crime~site*age))

